// myPoints.js
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        this.getDays();
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    },
    getDays: function() {
        var that = this;
        var myDate = new Date();
        var month = myDate.getMonth() + 1;
        var day = myDate.getDate();
        var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

        console.log(day);

        //获取日期--需要判定月份，从而判定当月多少天
        var months = daysInMonth[month];
        console.log(months);
        var days = []
        for (var i = 0; i < 10; i++) {
            if ((day + i) % months == 0) {
                days[i] = months
            } else {
                days[i] = (day + i) % months
            }
        }
        console.log(days)
            //			var days = [d.getDate() % months, (d.getDate() + 1) % months, (d.getDate() + 2) % months, (d.getDate() + 3) % months, (d.getDate() + 4) % months, (d.getDate() + 5) % months, (d.getDate() + 6) % months, (d.getDate() + 7) % months, ];
            //			console.log(days)


        that.setData({
            month: month,
            days: days
        })
    },
    chooseDay(e){
      console.log(e)
    }
})